package com.by.service.impl;

import com.by.bean.Goods;
import com.by.bean.params.GoodsQuery;
import com.by.common.bean.PageBean;
import com.by.common.crud.BaseServiceImpl;
import com.by.mapper.GoodsMapper;
import com.by.service.GoodsService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class GoodsServiceImpl extends BaseServiceImpl<Goods, GoodsMapper> implements GoodsService {

    @Override
    public PageBean search(GoodsQuery query) {
        PageHelper.startPage(query.getPage(), query.getPageSize());
        List list=baseMapper.search(query);
        PageInfo info=new PageInfo(list);
        return new PageBean<>(query.getPage(),query.getPageSize(),info.getTotal(),list);
    }
}
